package priv.menguer.intercepting.controller;

import java.util.ArrayList;
import java.util.List;

import priv.menguer.intercepting.service.Filter;

/**
 * @Title FilterChain.java
 * @description TODO
 * @time 2018年10月26日 下午2:40:04
 * @author menguer@126.com
 * @version 1.0
 */
public class FilterChain {
	private List<Filter> filters = new ArrayList<Filter>();
	private Target target;

	public void addFilter(Filter filter) {
		filters.add(filter);
	}

	public void execute(String request) {
		for (Filter filter : filters) {
			filter.execute(request);
		}
		target.execute(request);
	}

	public void setTarget(Target target) {
		this.target = target;
	}
}
